<?php

/********************************************************************
general function
********************************************************************/
session_start();

if ($_GET['do'] == 'check_for_updates' && $_COOKIE['update_on'] == 0) :
	setcookie("update_on", 1, time()+86400);
endif;

require_once TEMPLATEPATH. '/cp/module.php';

if (empty($comfy["style"]) || !isset($comfy["style"]) || $comfy["style"] == false) :
	$_SESSION['style'] = 'default';
	else :
	$_SESSION['style'] = $comfy["style"];
endif;

/********************************************************************
register sidebar widgets
********************************************************************/
if (function_exists('register_sidebar'))
register_sidebar(array(
'name'=>'Main Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot"></span></li>',
'before_title' => '<h2>',
'after_title' => '<a href="#minimize" class="Wminimize"></a><a href="#close" class="Wclose"></a></h2>'
));
register_sidebar(array(
'name'=>'Left Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot_s"></span></li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name'=>'Right Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot_s"></span></li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));

/********************************************************************
detecting videos archive
********************************************************************/
function get_video_cat_tpl($cat) {

	// this theme
	global $comfy;
	$subject = get_category_parents($cat, FALSE, ' ', FALSE);
	$pattern = '/^'. get_cat_name($comfy['videos']) .'/';

	if (preg_match($pattern, $subject)) :
		include TEMPLATEPATH. '/category-videos.php';
	else :
		include TEMPLATEPATH. '/archive.php';
	endif;

}

?>